package com.jmz.apt.api.message.response;


import com.jmz.apt.api.message.request.RequestMessageTemplate;

/**
 * <p> </p>
 *
 * @author Wang Yao
 * @version 1.0
 * @since 2019/1/29
 */
public class ResponseState {
    /**
     * 删除成功
     */
    public static String DELETE_SUCCESS = "DELETE_SUCCESS";
    /**
     * 删除失败
     */
    public static String DELETE_FAIL = "DELETE_FAIL";
    /**
     * 保存成功
     */
    public static String SAVE_SUCCESS = "SAVE_SUCCESS";
    /**
     * 保存失败
     */
    public static String SAVE_FAIL = "SAVE_FAIL";
    /**
     * 更新成功
     */
    public static String UPDATE_SUCCESS = "UPDATE_SUCCESS";
    /**
     * 更新失败
     */
    public static String UPDATE_FAIL = "UPDATE_FAIL";
    /**
     * 同步成功
     */
    public static String SYNC_SUCCESS = "SYNC_SUCCESS";
    /**
     * 同步失败
     */
    public static String SYNC_FAIL = "SYNC_FAIL";

    public static void setState(RequestMessageTemplate reqt, String bussText) {
        if (SAVE_SUCCESS.equals(bussText)) {
            reqt.addBussResponse("1", "保存成功");
        }
        if (SAVE_FAIL.equals(bussText)) {
            reqt.addBussResponse("0", "保存失败");
        }
        if (UPDATE_SUCCESS.equals(bussText)) {
            reqt.addBussResponse("1", "更新成功");
        }
        if (UPDATE_FAIL.equals(bussText)) {
            reqt.addBussResponse("0", "更新失败");
        }
        if (DELETE_SUCCESS.equals(bussText)) {
            reqt.addBussResponse("1", "删除成功");
        }
        if (DELETE_FAIL.equals(bussText)) {
            reqt.addBussResponse("0", "删除失败");
        }
        if (SYNC_SUCCESS.equals(bussText)) {
            reqt.addBussResponse("1", "同步成功");
        }
        if (SYNC_FAIL.equals(bussText)) {
            reqt.addBussResponse("0", "同步失败");
        }

    }
}
